home *** CD-ROM | disk | FTP | other *** search
- /****i* SOURCE_FILE/INFO
- *
- * NAME
- * HttpRequest.js
- *
- * USAGE
- * Part of Netobjects JavaScript Library.
- *
- * COPYRIGHT
- * Copyright ⌐ 2000-2005 Website Pros, Inc.
- * All Rights Reserved.
- *
- * This is an unpublished work protected by Website Pros, Inc.
- * as a trade secret, and is not to be used or disclosed except as
- * expressly provided in a written license agreement executed by
- * you and Website Pros, Inc.
- *
- * <copyright@websitepros.com>
- *
- * NOTES
- * JavaScript code.
- *
- *****/
- if (!IS_isModuleInitialized("IS.NOF.NET.HttpRequest"))
- {
-
- /****h* NOF_JavaScript_Library/NOF.NET.HttpRequest
- *
- * NAME
- * NOF.NET.HttpRequest
- *
- * DESCRIPTION
- *
- *
- ****/
-
- /**
- * constructor
- * @param url - URL
- **/
- function NET_HttpRequest( /*String*/ url ) {
- this.__proto__ = NET_HttpRequest.prototype;
-
- this.URL = url;
- this.method = "GET";
-
- this.headers = new Array();
- this.includeHeaderResult = false;
- this.includeBodyResult = true;
- this.postData = "";
- }
- {
- var member = NET_HttpRequest.prototype;
- member.CLASS_NAME = "NET.HttpRequest";
-
- var method = NET_HttpRequest.prototype;
-
- /**
- * Set a header value.
- *
- * @param headName
- * @param headValue
- **/
- method.addHeader = function (/*String*/ headName, /*String*/ headValue) { this.headers[headName] = headValue; }
-
- /**
- * Set a header value.
- *
- * @param headName
- * @param headValue
- **/
- method.setHeader = method.addHeader;
-
- /**
- * Get header value
- *
- * @return
- **/
- method.getHeader = function (/*String*/ headName) { return this.headers[headName]; }
- method.getHeaders = function () { return this.headers; }
-
- /**
- * Set method type. Only POST and GET values are allowed.
- *
- * @param method can be POST or GET
- **/
- method.setMethod = function (method) { this.method = method; }
-
- /**
- * Get method type
- *
- * @return POST or GET
- **/
- method.getMethod = function () { return this.method; }
-
- /**
- * Set additional data to be posted.
- *
- * @return
- **/
- method.setData = function (/*String*/ postData) {
- this.postData = postData;
- }
- method.getData = function () { return this.postData; }
-
- /**
- * Specify if the response should include headers. Default value is false.
- *
- * @param includeHeaderResult boolean
- **/
- method.setIncludeHeaderResult = function (/*boolean*/ includeHeaderResult) { this.includeHeaderResult = includeHeaderResult; }
- method.getIncludeHeaderResult = function () { return this.includeHeaderResult; }
-
- /**
- * Specify if the response should include content. Default value is true.
- *
- * @param includeBodyResult boolean
- **/
- method.setIncludeBodyResult = function (/*boolean*/ includeBodyResult) { this.includeBodyResult = includeBodyResult; }
- method.getIncludeBodyResult = function () { return this.includeBodyResult; }
- }
-
- NET.__proto__.HttpRequest = NET_HttpRequest;
- }